﻿@{
    ViewBag.Title = "Render Window";
    Layout = "~/Views/Shared/_BaseLayout.cshtml";
    var X = Html.X();
}

@section headtag
{
    <script>

        //子窗体通过Listeners(l => l.Click.Fn = "window.parent.showResult")来调用当前脚本
        var showResult = function (btn) {
            Ext.Msg.notify("Button Click", "You clicked the " + btn + " button");
            App.win234.close();
        };

        var showResultText = function (btn, text) {
            Ext.Msg.notify("Button Click", "You clicked the " + btn + 'button and entered the text "' + text + '".');
        };
    </script> 
}

@section example
{
    @(Html.X().Button()
        .Text("Show window")
        .DirectEvents(de =>
        {
            de.Click.Url = Url.Action("RenderWindow");
            de.Click.ExtraParams.Add(new Parameter("param","12345"));
        })
        )

    @(Html.X().Button()
        .Text("Show window1")
        .DirectEvents(de =>
        {
            de.Click.Url = Url.Action("RenderWindow1");
        })
        )

    @(Html.X().Button()
        .Text("Show window2")
        .Handler("App.win123.show(this)")
        )
        
     @(
        Html.X().Window().ID("win123").Hidden(true).ItemsFromPartial("Window")
     )

    @(Html.X().Button()
        .Text("Fn").Listeners(l => l.Click.Fn = "showResult")
    )
}